home *** CD-ROM | disk | FTP | other *** search
/ Top 200 Programs / Top 200 Programs.iso / Bob8 / THOMPSON / LIBERTY / PRODUCT / LB14W.EXE / CALLDLL2.BAS < prev    next >
BASIC Source File  |  1996-02-01  |  1KB  |  63 lines

  1.  
  2.     'CALLDLL2.BAS   Show how to enable/disable controls using API calls
  3.  
  4.     WindowWidth = 472
  5.     WindowHeight = 170
  6.  
  7.     enabled = 1
  8.  
  9.     checkbox #main.cbox, "Change me!", [cboxSet], [cboxReset], 22, 26, 344, 20
  10.     textbox #main.entry, 22, 81, 344, 25
  11.     statictext #main.statictext3, "Enter some text and then click on accept", 22, 56, 320, 20
  12.     button #main, "Accept", [accept], UL, 374, 81, 58, 25
  13.     open "Experiment!" for dialog as #main
  14.     h = hwnd(#main.cbox)
  15.  
  16. [main.inputLoop]   'wait here for input event
  17.     input aVar$
  18.     goto [main.inputLoop]
  19.  
  20.  
  21.  
  22. [cboxSet]   'Perform action for the checkbox named 'cbox'
  23.  
  24.     'Insert your own code here
  25.  
  26.     goto [main.inputLoop]
  27.  
  28.  
  29. [cboxReset]   'Perform action for the checkbox named 'cbox'
  30.  
  31.     'Insert your own code here
  32.  
  33.     goto [main.inputLoop]
  34.  
  35.  
  36. [accept]   'Perform action for the button named 'accept'
  37.  
  38.     print #main.entry, "!contents?"
  39.     input #main.entry, text$
  40.  
  41.     open "user" for dll as #user
  42.  
  43.     calldll #user, "SetWindowText", _
  44.         h as word, _
  45.         text$ as struct, _
  46.         result as short
  47.  
  48.     if enabled = 1 then _
  49.         enabled = 0 _
  50.       else _
  51.         enabled = 1
  52.  
  53.     calldll #user, "EnableWindow", _
  54.         h as word, _
  55.         enabled as ushort, _
  56.         result as ushort
  57.  
  58.     close #user
  59.  
  60.     goto [main.inputLoop]
  61.  
  62.  
  63.